def is_valid_brackets(sequence): 
    stack = [] 
    opening_brackets = "([{<" 
    closing_brackets = ")]}>" 
     
    for bracket in sequence: 
        if bracket in opening_brackets: 
            stack.append(bracket) 
        elif bracket in closing_brackets: 
            if len(stack) == 0: 
                return False 
            opening_bracket = stack.pop() 
            if opening_brackets.index(opening_bracket) != closing_brackets.index(bracket): 
                return False 
     
    return len(stack) == 0 
 
# Пример использования 
input_sequence = input("Введите скобочную последовательность: ") 
result = is_valid_brackets(input_sequence) 
print(result)
